Skip to content

test(sort_utils): ミューテーションテストで冗長テストを削減し検出力を強化#461

Merged
yusuke0610 merged 1 commit into
mainfrom
claude/mutmut-test-reduction-lb3xk4
Jul 3, 2026
Merged

test(sort_utils): ミューテーションテストで冗長テストを削減し検出力を強化#461
yusuke0610 merged 1 commit into
mainfrom
claude/mutmut-test-reduction-lb3xk4

Conversation

@yusuke0610

@yusuke0610 yusuke0610 commented Jul 3, 2026

Copy link
Copy Markdown
Owner

mutmut で test_sort_utils.py を分析し、統合テスト(resume 系)と重複して
固有ミュータントを殺していない冗長ユニットテスト 8 本を削除(19→12 本)。

あわせて検出力の穴を強化:

  • test_end_date_desc: start 降順と end 降順が食い違うデータ + 位置ベース
    assert に修正し、sort_key の end を無視する実装退行を検出可能に
  • ORM 属性アクセス(本番経路)を検証するテストを追加し、dict 入力偏重で
    未検証だった _get の getattr 分岐をカバー

結果: sort_utils の mutation score 79.7% → 94%(survived 15→4、残りは
等価ミュータント等の殺せないノイズ)。他ターゲットへの横展開では追加の
削除余地は無いことを確認済み。

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01RNCQYkKF5CrjxQt18YFeY5

Summary by CodeRabbit

  • Tests
    • Expanded coverage for sorting behavior, including object-based records, missing end dates, and full date-string handling.
    • Updated sort order checks to better verify correct ranking when start and end dates differ.
    • Simplified date-sorting test coverage to focus on key empty and parsing scenarios.

mutmut で test_sort_utils.py を分析し、統合テスト(resume 系)と重複して
固有ミュータントを殺していない冗長ユニットテスト 8 本を削除(19→12 本)。

あわせて検出力の穴を強化:
- test_end_date_desc: start 降順と end 降順が食い違うデータ + 位置ベース
  assert に修正し、sort_key の end を無視する実装退行を検出可能に
- ORM 属性アクセス(本番経路)を検証するテストを追加し、dict 入力偏重で
  未検証だった _get の getattr 分岐をカバー

結果: sort_utils の mutation score 79.7% → 94%(survived 15→4、残りは
等価ミュータント等の殺せないノイズ)。他ターゲットへの横展開では追加の
削除余地は無いことを確認済み。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RNCQYkKF5CrjxQt18YFeY5
@github-actions github-actions Bot added test テスト追加・修正 backend バックエンド labels Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fc8e89c0-a826-442e-9f51-984833b57d19

📥 Commits

Reviewing files that changed from the base of the PR and between 1319c74 and 2b0f25b.

📒 Files selected for processing (1)
  • backend/tests/test_sort_utils.py

📝 Walkthrough

Walkthrough

Test coverage in backend/tests/test_sort_utils.py was restructured: added SimpleNamespace import and two new tests for attribute-based sorting and full-string date parsing, rewrote test_end_date_desc, and removed several tests covering stability, string-date parsing, and mixed scenarios.

Changes

Sort utils test coverage update

Layer / File(s) Summary
Attribute-access and end-date sorting tests
backend/tests/test_sort_utils.py
Adds SimpleNamespace import, rewrites test_end_date_desc to validate end-based ordering via object identity, and introduces test_sort_by_attribute_access_objects for ORM-like attribute access sorting with missing-end fallback.
Date-desc test cleanup and full-string-date coverage
backend/tests/test_sort_utils.py
Removes test_mixed_scenario, test_date_desc_stable, and test_date_desc_with_string_dates; retains test_date_desc_empty and adds test_date_desc_with_full_string_dates for YYYY-MM-DD parsing.
Date-asc test simplification
backend/tests/test_sort_utils.py
Retains test_date_asc_empty and removes test_date_asc_multiple_none_stable, test_date_asc_stable, and test_date_asc_with_string_dates.

Estimated code review effort: 2 (Simple) | ~10 minutes

Related PRs: None identified.

Suggested labels: tests

Suggested reviewers: None identified.

Poem

A rabbit hops through test-file rows,
Trims the old, plants new ones in prose,
SimpleNamespace joins the sorting fray,
Full-string dates now parse their way,
Fewer tests, but sharper still it goes. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing redundant sort_utils tests and improving mutation-detection strength.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/mutmut-test-reduction-lb3xk4

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yusuke0610
yusuke0610 merged commit 61aca04 into main Jul 3, 2026
24 checks passed
@yusuke0610
yusuke0610 deleted the claude/mutmut-test-reduction-lb3xk4 branch July 20, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend バックエンド test テスト追加・修正

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants